UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'btvZGnkpyfCClrk4Z0cyWGKtmtKGOlR2Gb2TLWAOiLs=' 
WHERE 
  key_id = '78feeb24fbdaa1a3fdeb3a692d26ff5badccd0d7b5118d9b010dfed80ed87ffd' 
  AND (
    token = 'btvZGnkpyfCClrk4Z0cyWGKtmtKGOlR2Gb2TLWAOiLs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032