UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tpmmdi6jZR5egixFA56RDBd9729u8inE33ghzUoJyNw='
WHERE
key_id = '561c1738e97fc79bf3e1259ad0b6f51591ffa8c644daf9f1057f652e3029b145'
AND (
token = 'tpmmdi6jZR5egixFA56RDBd9729u8inE33ghzUoJyNw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)