UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0ZtAHsNlRGQQLEnOOT7HtiXSeLth31AY+pXjszvpsqE='
WHERE
key_id = 'c24c5b8018c3a45907d937686be4a8cb84e113071bec96e6bb7b194f26dcfc6f'
AND (
token = '0ZtAHsNlRGQQLEnOOT7HtiXSeLth31AY+pXjszvpsqE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)