UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'COw7EwQltx/8T0tXUY9gl5DFi8qd47/0CoXucO+5+HM=' 
WHERE 
  key_id = 'b3eda4f48128e9690874a0d31a72bed71cdaa5a0a1bcbbf8ddf3a4a980e05927' 
  AND (
    token = 'COw7EwQltx/8T0tXUY9gl5DFi8qd47/0CoXucO+5+HM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020