UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TTmCW3+hfrx4JQ3WAliEu63L10WVBwlJctLCiY6U9nY=' 
WHERE 
  key_id = 'bfdf5934528e74c048f0f2ea2ef27d72b0318d7bf8ee9068633f2f21b1131630' 
  AND (
    token = 'TTmCW3+hfrx4JQ3WAliEu63L10WVBwlJctLCiY6U9nY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030