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