UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6XJrIHyDaFtQbS1W5FM4whb89BGmBRvJPKl0bOjwaxw='
WHERE
key_id = '744474af5dd013df03e413a279691e78ea6bb0469496f1f18e185f89644f854a'
AND (
token = '6XJrIHyDaFtQbS1W5FM4whb89BGmBRvJPKl0bOjwaxw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)