UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gE4lfPKHLvPIhIOrPMB2EclHhQioFyRdS3k6etvtCyo='
WHERE
key_id = '8d5b5220e95fc18290846fec306fc0d407af378f248f88ff5fbdf6b869bfa345'
AND (
token = 'gE4lfPKHLvPIhIOrPMB2EclHhQioFyRdS3k6etvtCyo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)