UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xpoYWUaaJXKByLppdKrUxuChNLQ9jlh03LueiEX2cVw=' 
WHERE 
  key_id = '80b82c6e1997bce5b4b66c8aabd7672497ed4f17282e6c6cafb0822a81397aba' 
  AND (
    token = 'xpoYWUaaJXKByLppdKrUxuChNLQ9jlh03LueiEX2cVw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035