UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J+FakFN0iFNn/FIx/B7SOTknJefVgPeSNlrjux3CslM=' 
WHERE 
  key_id = '64d5fbdb698ac3ec0caec01a7867625fe8bab655283e34b2406d70f18a6a6ad5' 
  AND (
    token = 'J+FakFN0iFNn/FIx/B7SOTknJefVgPeSNlrjux3CslM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027