UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cXUkGbl1sYH11hEWXoDfnC2mfwyFXt7r4IZcx1GeCMA=' 
WHERE 
  key_id = '2ab812e793141177079272901d99f3daed139e82effff3fe4d853ea613129209' 
  AND (
    token = 'cXUkGbl1sYH11hEWXoDfnC2mfwyFXt7r4IZcx1GeCMA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033