UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'avag6PHu7Ha8NcPwd+5W7ov54MskNW5LBsIKZkn4ZLk='
WHERE
key_id = '4b7cbb8a547403a358923e9843c36a2e1eb4a8a342539e73d5558682c744551b'
AND (
token = 'avag6PHu7Ha8NcPwd+5W7ov54MskNW5LBsIKZkn4ZLk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)