UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KwAhKuOC3RBHnb0MP4Ciwbal7yLOXZVllfYtMLmV4hk=' 
WHERE 
  key_id = '6a204b1268a07b57fb4788116943a6a607dfa08c5a6431d128b8d32625fd6739' 
  AND (
    token = 'KwAhKuOC3RBHnb0MP4Ciwbal7yLOXZVllfYtMLmV4hk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051