UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '64wVH7Kxn3JtYbQul4Dhc+BdGgMO/KNR2N29rrauyr4=' 
WHERE 
  key_id = 'de7c4b7f64b632c7731326d7aa98ea9587238075e003e560c3f0569849164bf2' 
  AND (
    token = '64wVH7Kxn3JtYbQul4Dhc+BdGgMO/KNR2N29rrauyr4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028