UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VphU4zaKspOKjUJTlnku18ZpZAjnkhRR67S3CxF+Gyg=' 
WHERE 
  key_id = '5aac391148d61eb1b84410a25068bd6a241a2dd42d504c39c3be68a36b657d00' 
  AND (
    token = 'VphU4zaKspOKjUJTlnku18ZpZAjnkhRR67S3CxF+Gyg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039