UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZTcPdCk8JpIotcv//SsydBOrXFhp1DWJKa4Ar/+PWSg=' 
WHERE 
  key_id = 'aef1d104e4b907b2fb6e338f1b86688b027a898f7d0de5d1e82addc2884c6794' 
  AND (
    token = 'ZTcPdCk8JpIotcv//SsydBOrXFhp1DWJKa4Ar/+PWSg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030