UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YqzQeihq3gt53ZN9ErxLteZaCRXbbJGphpahFYGIVKk=' 
WHERE 
  key_id = 'a07ae66c390a51f8d0331e2e89f42fd66918d09f7ff34e1f3e96e02e845e508a' 
  AND (
    token = 'YqzQeihq3gt53ZN9ErxLteZaCRXbbJGphpahFYGIVKk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033