UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ilW4xClbqfA2cWP7JyrtuA9RBjcmTrbsKoy1R7IneFQ=' 
WHERE 
  key_id = '0fb336e709c659b7bcac7930a35e967b71dac98565492773567a9518f8279986' 
  AND (
    token = 'ilW4xClbqfA2cWP7JyrtuA9RBjcmTrbsKoy1R7IneFQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024