UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SAb+6HzIekPj1GJx9Z990Oe3ayBefBjZLtB2vse6gIc='
WHERE
key_id = 'e5419ff841d567f9ba0521b6890e80c9fee7964a85f63c43d075e21ee8672b72'
AND (
token = 'SAb+6HzIekPj1GJx9Z990Oe3ayBefBjZLtB2vse6gIc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)