UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q4/UXeXiL8n3t96bn+tXfYNerf3RmfT+4uP7QhHN24Y=' 
WHERE 
  key_id = '655cfa18cd9a35e6acb3251ce91174d32aa2be09825defae3631624cdab0c91e' 
  AND (
    token = 'Q4/UXeXiL8n3t96bn+tXfYNerf3RmfT+4uP7QhHN24Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037