UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SN57UWIARr0Pc0OxmKWN43lMK1zOkOTSIk0ibdaAdZ0='
WHERE
key_id = '0927d0160afd17b710ee77325f01e5555855091273d6d72b2d729af761193ebe'
AND (
token = 'SN57UWIARr0Pc0OxmKWN43lMK1zOkOTSIk0ibdaAdZ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)