UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'F1v4QM3UTwk4YbqhMoI9wTiWhaBb+qlIE639bWmunf4='
WHERE
key_id = '418bc9ec794b514a507095809876c11f714a05b0f3ff78880805a5d919e62546'
AND (
token = 'F1v4QM3UTwk4YbqhMoI9wTiWhaBb+qlIE639bWmunf4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)