UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g4sbb2BeSKodfKzru+OdCCzscMzgwdfT5VBcxgd3zpY=' 
WHERE 
  key_id = 'ff26fba9ba9b9952e1a5ca1a2d2d1576ef74f657fca3f7dbfc01c15f7c582439' 
  AND (
    token = 'g4sbb2BeSKodfKzru+OdCCzscMzgwdfT5VBcxgd3zpY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032