UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HecYWMx5+kWawHDdIt5ODvhRYbBAO/koJw1n9CQOsvU=' 
WHERE 
  key_id = '833d9c63463d2f554725668e516bdb5ec6b548976b60cc1d2e112d8ad3f63817' 
  AND (
    token = 'HecYWMx5+kWawHDdIt5ODvhRYbBAO/koJw1n9CQOsvU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022