UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fPvNghP8TF0jEhnmhbI4jR7mWIIqmifZwaViJ+TYKYk=' 
WHERE 
  key_id = 'ba1c8de24a8fc1d5864be439001b6dd58a2b8b546dfbaf9965ad7ed56f3d54d6' 
  AND (
    token = 'fPvNghP8TF0jEhnmhbI4jR7mWIIqmifZwaViJ+TYKYk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040