UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RCKCeUDFarHoLbBTpvkXPi0np7IKnf9xwij/UApWYYc=' 
WHERE 
  key_id = '4fa134e71fae621df173d12035bc65a2ca14fea7158d38409d668636b352efe3' 
  AND (
    token = 'RCKCeUDFarHoLbBTpvkXPi0np7IKnf9xwij/UApWYYc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028