UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2AP01SkIccThAvGFaxvMrstWACY6GrENRn1iMw6eVO8=' 
WHERE 
  key_id = 'e6cfc0b3982496efc7b036262fa295f670542653911d4dfc68aa7d334ec19835' 
  AND (
    token = '2AP01SkIccThAvGFaxvMrstWACY6GrENRn1iMw6eVO8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017