UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OjXxihVOlAstuVzZx9uyV+EolQrKKhMqRdlUY4jzmRs='
WHERE
key_id = '6577955dd45ac4f261dfc860038fa0b2521b3843d42d88eaa46652c60f321e1e'
AND (
token = 'OjXxihVOlAstuVzZx9uyV+EolQrKKhMqRdlUY4jzmRs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)