UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y+mJfjV1eUnA5z5KfViR2kMPjOYqqkwCjxr9IQxsGxU=' 
WHERE 
  key_id = '1e43542d4c884709c0f497bd27aa9394030c5ee348924ff1ae3feac0a049e9e8' 
  AND (
    token = 'Y+mJfjV1eUnA5z5KfViR2kMPjOYqqkwCjxr9IQxsGxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020