UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/BBg9u2ixIc1j63ic8jZl7PMS9l0Qs3vJ4NLLmarYys='
WHERE
key_id = '148c5222d453cf1af578fdb30d25034c068880633a34a575337d04c284ca990e'
AND (
token = '/BBg9u2ixIc1j63ic8jZl7PMS9l0Qs3vJ4NLLmarYys='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)