UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hvrgO2FNwx8C4iwz/uKXJKEgsdnyfKiYhxt2sNLO4AA=' 
WHERE 
  key_id = 'bfb698d8111619a921d00df77ea4a287291ef6ce751006f5b52be30a45ddc456' 
  AND (
    token = 'hvrgO2FNwx8C4iwz/uKXJKEgsdnyfKiYhxt2sNLO4AA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042