UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J+NjNiV16G+ypfDI5PMeXia4zrCZMr3qtGoGyrDWCWg='
WHERE
key_id = '3a5a1b8db8390cc3318bee45915d1a798e4f97c692f28fff0f64bb4ac68ad80e'
AND (
token = 'J+NjNiV16G+ypfDI5PMeXia4zrCZMr3qtGoGyrDWCWg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)