UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y5CqYNsC8Inu3b1xKn9y/ysddjF0Bv+LjWYBQgRwAT8=' 
WHERE 
  key_id = '547b2cfa73a1b9a16523871293e0801f375c74e2c74cc85238396104f2ba6863' 
  AND (
    token = 'Y5CqYNsC8Inu3b1xKn9y/ysddjF0Bv+LjWYBQgRwAT8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040