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