UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f2dojWok28VlvO84pHMZtxQstkLyk38tvW45BurBMP8=' 
WHERE 
  key_id = 'dc562b1f54eac6402834e9533f06f0c29de6d272fa07b2cd4a42805ae9b019d8' 
  AND (
    token = 'f2dojWok28VlvO84pHMZtxQstkLyk38tvW45BurBMP8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028