UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8Xyiz6xS+wd7K/rR1AgtJVvi7AmwbBmRQMWvgSS+H0s=' 
WHERE 
  key_id = '2e52f6c857c89f8da856b0985ad00e6915e60d64c4bc2e94f60151b9d72db1ae' 
  AND (
    token = '8Xyiz6xS+wd7K/rR1AgtJVvi7AmwbBmRQMWvgSS+H0s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036