UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't27WrqsQfixBJUXrXpwWZM+P8ahhWtZYbmj8C5llGwM=' 
WHERE 
  key_id = '65a4fcf0199ccb8348c14df095bc0baa1544582055a4a1c130cf5776ad389445' 
  AND (
    token = 't27WrqsQfixBJUXrXpwWZM+P8ahhWtZYbmj8C5llGwM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023