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