UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm+94qIpUVG9ubpvIUV9X5Lrbv8spv3do+6VXJci5Vac=' 
WHERE 
  key_id = '8788b04a6a3a58514d02ccb7bba09c7af71d7fee4fe664eef39100425ce6dd14' 
  AND (
    token = 'm+94qIpUVG9ubpvIUV9X5Lrbv8spv3do+6VXJci5Vac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032