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

Query time 0.00023