UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+DJpVcD6FxOf5f9lu+tXf50yMFpYInHkrmFVWxGf/MA='
WHERE
key_id = 'e9ceecd5588664fb7414d013cb545344bf882ba17fd55490357995447970084a'
AND (
token = '+DJpVcD6FxOf5f9lu+tXf50yMFpYInHkrmFVWxGf/MA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)