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