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