UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jaiaM6x/J1BsAhe+jptQUjipvM+YVQUz2hYyS8Kfbo8=' 
WHERE 
  key_id = '1eb70957b46faff6a7acd7eca60f8cb6c2ff1392ef3b66f3f19b3186371864b4' 
  AND (
    token = 'jaiaM6x/J1BsAhe+jptQUjipvM+YVQUz2hYyS8Kfbo8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058