UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tJg12+5biMvw/23KMts0c3lKVIa0SA8OXHn4ZOIULjM='
WHERE
key_id = '947cbd9b69deb5f29f87e03a09179e65e80a68d0567585b635015abd7bb24af1'
AND (
token = 'tJg12+5biMvw/23KMts0c3lKVIa0SA8OXHn4ZOIULjM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)