UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pv7cVBqSPdJxOpoV1MOQmHYbBYjhDAeNwHIa0SwwD+k=' 
WHERE 
  key_id = 'aae8f44614505193ceaaba72250bc6f45e0b534a4d9025183543f044ba1b0686' 
  AND (
    token = 'Pv7cVBqSPdJxOpoV1MOQmHYbBYjhDAeNwHIa0SwwD+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040