UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MLcKPZyXHJ9bs00tHY9kFQSheclj/rIp/LImFoSPNmM='
WHERE
key_id = 'c9385e622ef4833d4050354ccc63f295218f0c2f6289d7daf0df3e1946e6d497'
AND (
token = 'MLcKPZyXHJ9bs00tHY9kFQSheclj/rIp/LImFoSPNmM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)