UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M5H8K0W4P35+eX0W9Zc2LxYPwLWcBLZv4mn3739MT7w='
WHERE
key_id = 'ac5e94e8d510649e6f04146cca33d424cd307087ff8568afa2423bf27ca120c5'
AND (
token = 'M5H8K0W4P35+eX0W9Zc2LxYPwLWcBLZv4mn3739MT7w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)