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

Query time 0.00030