UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NHmIMaXbJv+iFJowB9qPXmbMVuqBW0jjaDunM0kwXFA='
WHERE
key_id = '42b2fc1e1b3ea4f4bbd307520276ab514a23f33d1da2a406014a07162e114522'
AND (
token = 'NHmIMaXbJv+iFJowB9qPXmbMVuqBW0jjaDunM0kwXFA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)