UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SN9ZhiW7jLC4aduer7lG75zVDTQKk1ouNwt+s8U0tUk='
WHERE
key_id = '0d0388fe28eda0ff948b29ca85ce70762da36632dea232b9af7fb540e7bc2ce3'
AND (
token = 'SN9ZhiW7jLC4aduer7lG75zVDTQKk1ouNwt+s8U0tUk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)