UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qnXIMBztLHL3ZhLbdZ4m3rpdoHPqIN5CncMOzG/wmpg='
WHERE
key_id = 'd09523b124ea2c684f2d1e6f643b399f4f25797caf1bfa9631a32342553df95c'
AND (
token = 'qnXIMBztLHL3ZhLbdZ4m3rpdoHPqIN5CncMOzG/wmpg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)