UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3blsJFsYOtsBUR0TPV7Fy5+K11yLPwPMY8hSZI+++q0='
WHERE
key_id = '17b5313775390477f2a4d8be2fd12b23a75082edbe8cb15ec434f7038cd1c8c3'
AND (
token = '3blsJFsYOtsBUR0TPV7Fy5+K11yLPwPMY8hSZI+++q0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)