UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'is+lC3j3ZA5s9vEaOxSac8XcqtN02QAPsSnGmZ8VAqM=' 
WHERE 
  key_id = '5120f9322472758bae92519e197780e696a5e29d9f02c190566012f989072883' 
  AND (
    token = 'is+lC3j3ZA5s9vEaOxSac8XcqtN02QAPsSnGmZ8VAqM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016