UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wxd8rDlXzFUjPbba9ZqOp9UiRrMcrJNpPLIeGgfofog=' 
WHERE 
  key_id = '0230bb8c33d922016250e4a3d6f1d6f24d679ff668a1dc9b99b1fdde28931ce9' 
  AND (
    token = 'wxd8rDlXzFUjPbba9ZqOp9UiRrMcrJNpPLIeGgfofog=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037