UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RmJZQGM+04EO2xsW9jj/M0VfLNw0/ZOxvM5S5+uSvHA=' 
WHERE 
  key_id = 'ae8772d3452dbed681636327e4776b009a59e124633a714b06ebc67a932c3f1d' 
  AND (
    token = 'RmJZQGM+04EO2xsW9jj/M0VfLNw0/ZOxvM5S5+uSvHA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029