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

Query time 0.00025