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

Query time 0.00038