UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bInvAYlN96y86w01GKOaPHQUHy8ZixTV+Ccjkd9nMYI=' 
WHERE 
  key_id = '3c5674184088ee81e4cc04a563226ec780ac2438a55b90efe8407d29ed159848' 
  AND (
    token = 'bInvAYlN96y86w01GKOaPHQUHy8ZixTV+Ccjkd9nMYI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048