UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rfn8mLKlZgk/iasU9XoUnlTzu/ogrpbmg5FwLPjzGVA=' 
WHERE 
  key_id = '903d3094937d8531cb9533e7ddc0e2b90283f9d090150037d3b6617e409f5373' 
  AND (
    token = 'Rfn8mLKlZgk/iasU9XoUnlTzu/ogrpbmg5FwLPjzGVA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031